var app = getApp();
Page({


  data: {
    qq:0,
    qsList:[],
    id:0,
    name:''
  },

  onLoad: function (e) {
    console.log(e)
    var that = this
    that.setData({
      qq:e.qq
    })
    app.util.request({
      url: "entry/wxapp/Api",
      data: {
        m: "monai_market",
        r: "extends.city",
        pid:e.id
      },
      success: function (t) {
        console.log(t)
        that.setData({
          qsList:t.data.data
        });
      }
    });
    that.setData({
      id: e.id,
      name: e.name
    })
  },
  shi:function(e){
    console.log(e)
    var that= this , city = e.currentTarget.dataset.name, region = [],sheng = []
    region.push(that.data.name, city)
    sheng.push(that.data.name)
    console.log(region)
    var pages = getCurrentPages();
    var currPage = pages[pages.length - 1];   //当前页面
    var prevPage = pages[pages.length - 3];  //返回的页面
  
    if (city == '全省' && that.data.qq == 0){
      prevPage.setData({
        region: sheng,
        xiugai: 100,
        search_arr: [{ check_name: that.data.name, active_index: 8 }]
      });
    } else if (city == '全省' && that.data.qq == 1){
      prevPage.setData({
        location: that.data.name,
      });
    } else if (that.data.qq == 1){
      prevPage.setData({
        location: city,
      });
    }else{
      console.log('gggg')
      prevPage.setData({
        region: region,
        xiugai: 100,
        search_arr: [{ check_name: that.data.name, active_index: 8 }, { check_name: city, active_index: 8 }]
      });
    }
    wx.navigateBack({ delta: 2 });
  }
})